//
//  BSBluetootnAndBatteryView.m
//  SuoSiApp
//
//  Created by zhang on 16/4/7.
//  Copyright © 2016年 Ym. All rights reserved.
//

#import "BSBluetootnAndBatteryView.h"

@implementation BSBluetootnAndBatteryView

- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview1];
    }
    return self;
}
- (void)addSubview1{
    [self.saveBT removeFromSuperview];

//    添加这几个功能键
    
    CGRect frame1 = CGRectMake(0, self.navigationView.bottom+3, kScrenWidth, 43);
//    一键上传
    self.passBT = [self makeFunctionBTWithFrame:frame1 Name:@"sz_001.png" Text:@"一键上传" :1];
//    self.passBT.backgroundColor = BSGreen;
    [self.passBT addTarget:self action:@selector(selector) forControlEvents:(UIControlEventTouchUpInside)];
//  我的信息
    CGRect frame2 = CGRectMake(0, self.passBT.bottom+1, self.passBT.width, self.passBT.height);
    self.myInfoBT = [self makeFunctionBTWithFrame:frame2 Name:@"sz_002.png" Text:@"我的信息" :2];
//    添加家属
    CGRect frame3 = CGRectMake(0, self.myInfoBT.bottom+1, self.myInfoBT.width, self.myInfoBT.height);
    self.addFamilyBT = [self makeFunctionBTWithFrame:frame3 Name:@"sz_003.png" Text:@"添加家属" :3];
//    密码设置
    CGRect frame4 = CGRectMake(0, self.addFamilyBT.bottom+3, self.passBT.width, self.passBT.height);
    self.setPasswordBT = [self makeFunctionBTWithFrame:frame4 Name:@"sz_004.png" Text:@"密码设置" :4];
//    解除绑定设备
    CGRect frame10 = CGRectMake(0, self.setPasswordBT.bottom + 1, self.passBT.width, self.passBT.height);

    self.freeDeviceBT = [self makeFunctionBTWithFrame:frame10 Name:@"settings_unbind.png" Text: @"解除绑定设备" :10];
   
    
//    选项设置与设备信息
    CGRect frame5 = CGRectMake(0, self.freeDeviceBT.bottom+1, self.passBT.width, self.passBT.height);
    self.optionAndDeviceBT = [self makeFunctionBTWithFrame:frame5 Name:@"sz_005.png" Text:@"选项设置与设备信息" :5];
    
//    换肤
    CGRect frame6 = CGRectMake(0, self.optionAndDeviceBT.bottom+1, self.passBT.width, self.passBT.height);
    self.changeSkinBT = [self makeFunctionBTWithFrame:frame6 Name:@"sz_006" Text:@"换肤" :6   ];
//    系统更新
//    CGRect frame7 = CGRectMake(0, self.changeSkinBT.bottom+1, self.passBT.width, self.passBT.height);
//    self.sysUpdate = [self makeFunctionBTWithFrame:frame7 Name:@"sz_007" Text:@"系统更新" :7];
    
    
}
//  这里选择 是用tag值 标识这7个button 还是  各起一个名字

- (UIButton *)makeFunctionBTWithFrame:(CGRect)frame Name:(NSString * )name Text:(NSString *)text :(NSInteger)tag{

    UIButton *FCbutton = BSButton;
    FCbutton.frame = frame;
    FCbutton.backgroundColor = BSWhite;
    
    UIButton *iconBT = BSButton;
    iconBT.frame = CGRectMake(kMartin10, kMartin10, 28, 28);
    
    [iconBT setBackgroundImage:[UIImage imageNamed:name] forState:(UIControlStateNormal)];
    
    UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake(iconBT.right + kMartin10, kMartin10, frame.size.width - kMartin20 - iconBT.right , frame.size.height - 20)];
    lable.text = text;
    lable.font = [UIFont systemFontOfSize:20];

    
    [FCbutton addSubview:iconBT];
    [FCbutton addSubview:lable];
    
    [self addSubview:FCbutton];
    
    return FCbutton;
}


- (void)selector{
    NSLog(@"一键上传");
}

@end
